#ifndef __SLOTHTTPD_PARSER_REQUEST_LINE_PARSER_HPP__
#define __SLOTHTTPD_PARSER_REQUEST_LINE_PARSER_HPP__

#include <slothttpd/types.hpp>
#include <slothttpd/ngx_parser/ngx_parser.h>
#include <slothttpd/http/request.hpp>
#include <slothttpd/http/method.hpp>
#include <slothttpd/data_buffer.hpp>
#include <slothttpd/parser/result_type.hpp>

#include <utility>

namespace slothttpd {
namespace parser {

class request_line_parser
{
public:
    request_line_parser() noexcept;

    result_type parse(receive_buffer_list &seq);

    http::version_t http_version() const noexcept;
    
    char_range_t method_name() const noexcept;
    http::method::method_type method() const noexcept;
    char_range_t schema() const noexcept;
    char_range_t host() const noexcept;
    char_range_t port() const noexcept;
    char_range_t path() const noexcept;
    char_range_t path_extension() const noexcept;
    char_range_t query_string() const noexcept;
    
    bool is_quoted_uri() const noexcept;
    
    /**
    ngx_str_t                         http_protocol;

    u_char                           *uri_start;
    u_char                           *uri_end;
    u_char                           *uri_ext;
    u_char                           *args_start;
    u_char                           *request_start;
    u_char                           *request_end;
    u_char                           *method_end;
    u_char                           *schema_start;
    u_char                           *schema_end;
    u_char                           *host_start;
    u_char                           *host_end;
    u_char                           *port_start;
    u_char                           *port_end;
    
    ngx_str_t                         http_protocol;
     */

    ngx_http_request_t   d;
};

} //namespace parser
} //namespace slothttpd

#endif
